<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<xsl:template match="/">
	<html><head>
	<style>
	.n0,.n1,.n2,.n3,.n4,.n5,.n6,.n7,.n8,.n9,.n10{
		width:30px;
		text-align:center;
	}
	.n0{
		color:gray;
	}
	.n1,.n2,.n3,.n4{
	color:red;
	}
	.n5,.n6,.n7{
	color:green;
	}
	.n8,.n9,.n10{
	color:blue;
	}
	table #notasTable{
	font-family:arial;
	font-size:10px;
	}
	#notasTable thead{
	font-family:arial;
	font-size:10px;
	background: #FCD387;
	text-align:center;
	}
	.Alumno{
	font-size:12px;
	}
	td{
	border:solid 1px gray;
	
	}
	.detallenotas{
	font-size:10px;
	width:100px;
	}
	.notaNombre{
		width:50px;
		height:20px;
		overflow:hidden;
	}
	.ItemNota{
		width:50px;
		height:20px;
		overflow:hidden;
	}
	.periodoactual{
	background: #FEF0D6;
	text-align:center;
	}
	.promedioGral{
	background: #FCD387;
	text-align:center;
	font-size:16px;
	}
	</style>
	<script language="javascript">
	function modificarNotas(idAlumno, Nombre){
		window.open("detallenotaalumno.aspx");
		//alert("Modificar las notas de "+ Nombre);
	}
	</script>
	</head>
		<body>
			<table id="notasTable">
			<thead>
			<td style="width:250px;">Alumno</td>
			<td>Nota 1</td>
			<td>Nota 2</td>
			<td>Observaciones</td>
			</thead>
			<xsl:for-each select="alumnos/alumno">
			<tr class="alumno">
			<td><xsl:value-of select="@nombre"/>
			<input type="hidden" name="idalumno">
			<xsl:attribute name="value"><xsl:value-of select="@idAlumnoCurso"></xsl:value-of></xsl:attribute>
			</input>
			</td>
				<xsl:apply-templates select="notas" mode="Carga"></xsl:apply-templates>
				<td>
				<input type="Text" >
				<xsl:attribute name="name">cboNota<xsl:value-of select="@idAlumnoCurso"></xsl:value-of></xsl:attribute>
				<xsl:attribute name="value">
				<xsl:value-of select="observacion"></xsl:value-of></xsl:attribute>
				</input>
				</td>
			</tr>
			</xsl:for-each>
			</table>
		</body>
	</html>
</xsl:template>

<!--PERIODOS-->
<xsl:template match="periodos/periodo">
<td >
<xsl:if test="@actual">
<xsl:attribute name="class">periodoactual</xsl:attribute>
</xsl:if>
<xsl:if test="@resumen">
<xsl:attribute name="class">promedioGral</xsl:attribute>
</xsl:if>
<span><xsl:attribute name="class">
		n<xsl:value-of select="round(.)"/>
	</xsl:attribute>
		<xsl:call-template name="NotaNumero"/>
</span></td>
</xsl:template>
<!--PERIODOS-->



<!-- detalle de notas -->
<xsl:template match="notas">
<td><table class="detallenotas">
<xsl:for-each select="nota">
	<tr>
	<xsl:attribute name="title"><xsl:value-of select="@name"/></xsl:attribute>
	<xsl:apply-templates select="item"/>
	</tr></xsl:for-each></table><a href="#"><xsl:attribute name="onClick">
	modificarNotas(<xsl:value-of select="parent::node()/@idAlumno"/>,'<xsl:value-of select="parent::node()/@nombre"/>');	
</xsl:attribute>Editar</a>
</td>
</xsl:template>
<!-- Fin detalle de notas -->


<!-- nota item -->
<xsl:template match="item">
	<td>
	<div style="text-align:center">
	<xsl:attribute name="title">
		<xsl:value-of select="parent::node()/@name"/>/<xsl:value-of select="@detalle"/>
	</xsl:attribute>
	<xsl:attribute name="class">n<xsl:value-of select="round(.)"/></xsl:attribute>
		<xsl:attribute name="value">
			<xsl:value-of select="."/>
		</xsl:attribute>
	<xsl:call-template name="NotaNumero"/>
	</div>
		</td>
</xsl:template>

<xsl:template name="NotaNumero">
	<xsl:variable name="notaNumero">
			<xsl:value-of select="round(.)"/>	
		</xsl:variable>
		<xsl:value-of select="//letra/nota[@valor=$notaNumero]/parent::node()/@letra"></xsl:value-of>
</xsl:template>
<!-- nota item -->



<!-- detalle de notas -->
<xsl:template match="notas" mode="Carga">
<td>
<select >
<xsl:attribute name="name">cboNota<xsl:value-of select="parent::node()/@idAlumnoCurso"/></xsl:attribute>
<option value="0">Seleccione..</option>
<xsl:for-each select="/alumnos/notas/nota">
<option>
<xsl:attribute name="class">n<xsl:value-of select="@valor"/></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="@valor"/></xsl:attribute>
<xsl:value-of select="@descripcion"/></option>
</xsl:for-each>
</select>
</td>
<td>
<select>
<xsl:attribute name="name">cboNota<xsl:value-of select="parent::node()/@idAlumnoCurso"/></xsl:attribute>
<option value="0">Seleccione..</option>
<xsl:for-each select="/alumnos/notas/nota">
<option>
<xsl:attribute name="class">n<xsl:value-of select="@valor"/></xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="@valor"/></xsl:attribute>
<xsl:value-of select="@descripcion"/></option>
</xsl:for-each>
</select>
</td>
</xsl:template>
<!-- Fin detalle de notas -->

</xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2004. Sonic Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="ResumenNotas" userelativepaths="yes" externalpreview="no" url="Untitled2.xml" htmlbaseurl="" outputurl="" processortype="internal" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->